package com.project.baowei.dialog;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.wangshen.base.dialog.base.BaseDialog;
import com.wangshen.projectbase.R;

public class NewLoadingDialog extends Dialog {
    private ImageView imageView;

    public NewLoadingDialog(@NonNull Context context) {
        super(context,R.style.TransparentDialog);
        initView();
    }

    public NewLoadingDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
    }

    /*public NewLoadingDialog(@NonNull Context context) {
        super(context,R.style.TransparentDialog);
    }*/


    public void initView() {
        setContentView(getView());
        imageView=findViewById(R.id.tv_loading);
        setCanceledOnTouchOutside(false);
        //getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }

    @Override
    public void show() {
        super.show();
        Animation myAlphaAnimation= AnimationUtils.loadAnimation(getContext(), R.anim.loading);
        myAlphaAnimation.setInterpolator(new LinearInterpolator());
        imageView.startAnimation(myAlphaAnimation);

    }


    public int getView() {
        return R.layout.dialog_loading;
    }
}
